package org.goldenmock.web.matchers;

import org.goldenmock.web.server.EasyHttpRequest;

/**
 * @author Robin Wagenaar
 * @author Arjen van Staalduinen
 */
public class RequestParamExistsMatcher extends EasyRequestMatcher {
    private String key;

    public RequestParamExistsMatcher(String key) {
        this.key = key;
    }

    @Override
    public boolean matchesEasyRequest(EasyHttpRequest easyHttpRequest) {
        return easyHttpRequest.getParameterMap().containsKey(key);
    }

    public void appendTo(StringBuffer buffer) {
        buffer.append("RequestParamContainsMatcher matches param [").append(key).append("]");
    }
}
